package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.it.networkassets.InterfaceStatus;
import com.glsc.ngateway.common.base.domainmapper.InterfaceStatusMapper;
import com.glsc.ngateway.common.api.platform.dto.it.networkassets.InterfaceStatusDto;

import java.util.List;
import java.util.stream.Collectors;

public class InterfaceStatusConverter {
    public static InterfaceStatusDto do2Dto(InterfaceStatus domain){
        return InterfaceStatusMapper.INSTANCE.domain2dto(domain);
    }

    public static List<InterfaceStatusDto> do2Dto(List<InterfaceStatus> doList){
        return CollectionUtils.isEmpty(doList) ? java.util.Collections.emptyList() : doList.stream().map(InterfaceStatusConverter::do2Dto).collect(Collectors.toList());
    }

    public static InterfaceStatus dto2Do(InterfaceStatusDto dto){
        return InterfaceStatusMapper.INSTANCE.dto2domain(dto);
    }

    public static List<InterfaceStatus> dto2Do(List<InterfaceStatusDto> dtoList){
        return CollectionUtils.isEmpty(dtoList) ? java.util.Collections.emptyList() : dtoList.stream().map(InterfaceStatusConverter::dto2Do).collect(Collectors.toList());
    }
}
